#VPATH = tensorflow/lite/micro
#vpath %.cc tensorflow/lite/micro
CC_SRC=$(wildcard tensorflow/lite/micro/*.cc)
CC_SRC+=$(wildcard tensorflow/lite/micro/arena_allocator/*.cc)
CC_SRC+=$(wildcard tensorflow/lite/micro/kernels/*.cc)
CC_SRC+=$(wildcard tensorflow/lite/micro/memory_planner/*.cc)
CC_SRC+=$(wildcard tensorflow/lite/c/*.cc)
CC_SRC+=$(wildcard tensorflow/lite/schema/*.cc)
CC_SRC+=$(wildcard tensorflow/lite/core/api/*.cc)
CC_SRC+=$(wildcard tensorflow/lite/kernels/*.cc)

CC_OBJS=$(patsubst %.cc,%.o,$(CC_SRC))
$(info $(CC_SRC))
$(info $(CC_OBJS))
CROSS_COMPILE:=arm-linux-musleabi-
CCFLAGS:=-march=armv7-a -mtune=cortex-a7 -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing -fcommon -msoft-float -Wall -O0 -gdwarf-2 -Woverloaded-virtual -fno-exceptions -fno-rtti -std=c++11
CCFLAGS += -I. -Ithird_party/flatbuffers/include
TARGET:=libtflm.a

$(TARGET):$(CC_OBJS)
	$(CROSS_COMPILE)ar -rsv $@ $^

%.o:%.cc
	$(CROSS_COMPILE)g++ $(CCFLAGS) $^ -o $@

clean:
	rm -frv $(CC_OBJS) $(TARGET)
